package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.DecisionConfigService;
import com.yixun.qfbao.apidto.GetOverdueConfigInfoReqDto;
import com.yixun.qfbao.apidto.GetOverdueConfigInfoResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetOverdueConfigInfoReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GetOverdueConfigInfoHander extends CommonAbstractHander {
    private static Logger logger= LoggerFactory.getLogger(GetOverdueConfigInfoHander.class);
    @Autowired
    DecisionConfigService decisionConfigService;
    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        GetOverdueConfigInfoReqVo req = (GetOverdueConfigInfoReqVo)reqDto;
        GetOverdueConfigInfoReqDto getOrgCommissionPageReqDto = req.getParams();
        BaseResponseDTO<GetOverdueConfigInfoResDto> res = new BaseResponseDTO<GetOverdueConfigInfoResDto>();
        GetOverdueConfigInfoResDto resDto = new GetOverdueConfigInfoResDto();
        try{
            resDto = decisionConfigService.getOverdueConfigInfo(getOrgCommissionPageReqDto);
        } catch (Exception e) {
            logger.error("GetOverdueConfigInfoHander error: {}", e);
            resDto.setResult(ResultEnum.FAIL.getNo());
            resDto.setResultMsg("获取逾期配置失败!");
        }
        res.setResData(resDto);
        res.setResult(resDto.getResult());
        return res;
    }
}
